﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using InfoSite.Data;
using InfoSite.Tools;
using Resources;

namespace WebClient
{
    public partial class Contacts : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = String.Format("{0} - {1}", SiteResources.resCompanyName, SiteResources.resContacts);

            if (!Page.IsPostBack)
            {
                List<SiteContent> scContacts = SiteContent.ListAllContent((int)EnumHelper.ContentType.Contacts, true);
                if (scContacts != null && scContacts.Count > 0)
                {
                    SiteContent targetSiteContent = scContacts.SingleOrDefault();
                    if (targetSiteContent != null)
                    {
                        lContentTitle.Text = targetSiteContent.Title;
                        lContent.Text = targetSiteContent.Content;
                    }
                }

                List<SiteContent> scBank = SiteContent.ListAllContent((int)EnumHelper.ContentType.Bank, true);
                if (scBank != null && scBank.Count > 0)
                {
                    SiteContent targetSiteContent = scBank.SingleOrDefault();
                    if (targetSiteContent != null)
                    {
                        lBankTitle.Text = targetSiteContent.Title;
                        lBankContent.Text = targetSiteContent.Content;
                    }
                }

                List<SiteContent> scMap = SiteContent.ListAllContent((int)EnumHelper.ContentType.Map, true);
                if (scMap != null && scMap.Count > 0)
                {
                    SiteContent targetSiteContent = scMap.SingleOrDefault();
                    if (targetSiteContent != null)
                    {
                        lMapTitle.Text = targetSiteContent.Title;
                        lMapContent.Text = targetSiteContent.Content;
                    }
                }
            }
        }
    }
}